//package cn.wolfcode.wolf2w.business.controller.admin;
//
//import cn.wolfcode.wolf2w.business.api.domain.QuestionCollection;
//import cn.wolfcode.wolf2w.business.service.IQuestionCollectionService;
//import cn.wolfcode.wolf2w.common.core.domain.R;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.domain.Page;
//import org.springframework.web.bind.annotation.*;
//
//@Api(tags = "问题收藏后台管理")
//@RestController
//@RequestMapping("/admin/collections")
//public class QuestionCollectionAdminController {
//
//    @Autowired
//    private IQuestionCollectionService questionCollectionService;
//
//    @ApiOperation("分页查询收藏记录")
//    @GetMapping("/page")
//    public R<Page<QuestionCollection>> page(
//            @ApiParam("页码") @RequestParam(defaultValue = "1") Integer page,
//            @ApiParam("每页大小") @RequestParam(defaultValue = "10") Integer pageSize,
//            @ApiParam("用户ID") @RequestParam(required = false) Long userId,
//            @ApiParam("问题ID") @RequestParam(required = false) Long questionId) {
//        Page<QuestionCollection> pageInfo = questionCollectionService.getCollectionPage(page, pageSize, userId, questionId);
//        return R.ok(pageInfo);
//    }
//
//    @ApiOperation("删除收藏记录")
//    @DeleteMapping("/{id}")
//    public R<?> delete(@ApiParam("收藏记录ID") @PathVariable Long id) {
//        questionCollectionService.removeById(id);
//        return R.ok();
//    }
//
//    @ApiOperation("批量删除收藏记录")
//    @DeleteMapping("/batch")
//    public R<?> batchDelete(@ApiParam("收藏记录ID数组") @RequestBody Long[] ids) {
//        for (Long id : ids) {
//            questionCollectionService.removeById(id);
//        }
//        return R.ok();
//    }
//
//    @ApiOperation("获取收藏记录详情")
//    @GetMapping("/{id}")
//    public R<QuestionCollection> get(@ApiParam("收藏记录ID") @PathVariable Long id) {
//        return R.ok(questionCollectionService.getById(id));
//    }
//
//    @ApiOperation("统计用户收藏数")
//    @GetMapping("/count/{userId}")
//    public R<Integer> countByUser(@ApiParam("用户ID") @PathVariable Long userId) {
//        int count = questionCollectionService.countByUser(userId);
//        return R.ok(count);
//    }
//
//    @ApiOperation("统计问题被收藏数")
//    @GetMapping("/count/question/{questionId}")
//    public R<Integer> countByQuestion(@ApiParam("问题ID") @PathVariable Long questionId) {
//        int count = questionCollectionService.countByQuestion(questionId);
//        return R.ok(count);
//    }
//}